<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="" />
<meta name="format-detection" content="telephone=no">
<title>兑换记录</title>
<link rel="stylesheet" href="../css/exchange.css">
<link rel="stylesheet" href="../css/exchange/exchange.css">
<%@ include file="../general.jsp"%>
</head>
<body ontouchstart>
	<section class="ui-container">
	<div class="ex_bottom">
		<table class="product_in" cellspacing="0" cellpadding="0">

			<tr>
				<th>兑换内容</th>
				<th>兑换时间</th>
				<th>兑换状态</th>
			</tr>
			<tbody id="list">
				
			</tbody>
		</table>
		<div class="loading" id="loading"><a href="#">加载中...</a></div>
	</div>
	<div class="return_btn">
		<a href="#">
			<div class="return_btn_in">
				<img src="../images/weip.png" alt="">  
				<p>（返回微交易）</p>
			</div>
		</a>
	</div>
	</section>
	<!-- /.ui-container-->
	<input type="hidden" name="${_csrf.parameterName}"  value="${_csrf.token}" />
</body>
</html>
<script>
$(function(){ 
	productPage(1);
}); 

function productPage(currentPage){
	$.ajax({
		type : 'POST',
		url : "getUserConvertIndent.do",
		data : {
			"offset" : currentPage,
			"_csrf" : $('[name="_csrf"]').val()
		},
		async : 'true',
		dataType : 'json',
		success : function(data){
			var rec = data.item.resultList;
			var html = "";
			for(i = 0; i < rec.length; i++){
				html +="<tr class='tr_in'>";
				html +="<td>"+rec[i].productname+"</td>";	
				html +="<td>"+FormatDateTimestamp(rec[i].create_dt)+"</td>";
				if(rec[i].orderStatus==1)
					html +="<td>申请中</td>";
				else if(rec[i].orderStatus==2)
					html +="<td>审核中</td>";
				else if(rec[i].orderStatus==3)
					html +="<td>已取消</td>";
				else if(rec[i].orderStatus==4)
					html +="<td>发货中</td>";
				html +="</tr>";
				}
			$("#list").append(html);
			
			if(data.item.currentPage>=data.item.nextPage)
				$("#loading").html("<a href='#'>所有兑换记录加载完</a>");
			else
			$("#loading").html("<a href='javascript:productPage("+data.item.nextPage+")'>更多兑换记录</a>");
		}
	});
}
</script>